package API.File.Practise;

import java.io.File;

import static API.File.Practise.MainFile.mainFilePath;

public class _2FindFilesWithTxt {
    public static void main(String[] args) {
        File file = new File(mainFilePath);
        File[] filesWithTxt = file.listFiles(f ->
                f.isFile() && f.getName().endsWith(".txt"));
        if (filesWithTxt != null) {
            for (int i = 0; i < filesWithTxt.length; i++) {
                System.out.println(filesWithTxt[i].getAbsoluteFile());
            }
        } else {
            System.out.println("no right file");
        }
    }
}
